var mongoose=require('../../cfg/dbconfig.js')

var temperatureSchema=new mongoose.Schema({
    "stuname":String,
    "temperature":String,
    "date":String
},{collection:'daka'})

temperatureSchema.statics.getTemperByName=async function(query){
    let result = await this.aggregate([{ $match: { "stuname": query } }, {
        "$sort": { "date": 1 }
    }]).exec()
    return result;
}

module.exports=mongoose.model('daka',temperatureSchema)